# -*- encoding=utf8 -*-
"""
RedFlag-TC000043   道具支持特效及滤镜
道具+特效+滤镜拍摄场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("---------------------------------道具+特效+滤镜拍摄场景-------------------------------------")
"""
进入相机拍摄
点击道具
点击冰雪贺新春
等待元素显示
点击道具进行下载
等待道具下载完成
收起道具面板
点击滤镜
选择自然滤镜
收起滤镜面板
选择拍7秒
点击拍摄按钮
等待进入装饰页
点击保存
断言
"""
shooter.enter_photograph()
shooter.click_element(shooting_page_prop)
shooter.wait_for_element_appearance(shooting_page_select_prop,20)
shooter.click_element(prop_ice_celebrate_Chinese_new_year)
shooter.click_element(shooting_page_select_prop[0])
shooter.wait_for_element_disappearance(shooting_page_select_prop[0].offspring("cn.migu.video.clip.walle:id/clip_iv_item_img_download"))
touch((0.40,0.45), 1)
shooter.click_element(shooting_page_filter)
shooter.click_element(shooting_page_filter_nature)
touch((0.40,0.45), 1)
shooter.click_element(shooting_page_15_seconds)
shooter.click_element(shooting_button)
shooter.wait_for_element_appearance(decoration_page_return_button,20)
shooter.click_element(decoration_page_save)
shooter.wait_for_element_disappearance(decoration_page_save_animation, 30)
shooter.assert_image_exists(r"tpl1746625897140.png", "断言失败，没有找到对应的保存成功图片", record_pos=(-0.001, -0.016), resolution=(1224, 2700), threshold=0.6)

# 关闭应用
stop_app(UGC_package_name)